The following properties allow you to style and format text-based views, such as Text or Label, in ways that closely mirror SwiftUI’s built-in modifiers. By customizing these properties, you can control the font, weight, design, spacing, and other typographic attributes of the displayed text.
These properties are generally passed to text-related views like Text or Label components as attributes. For example, you can specify a font size, enable bold formatting, or add an underline with a custom color—all without manually calling multiple modifiers.
In the example above, the text uses a custom font, semibold weight, italic style, a red underline, limits to two lines, and centers the text.
fontDefines the font and size to apply to the text.
14), it applies the system font at that size.Font type): Use one of the built-in text styles ("largeTitle", "title", "headline", "subheadline", "body", "callout", "footnote", "caption"). The system determines the size and weight based on that style.name and size.fontWeightSets the thickness of the font’s stroke. Options range from "ultraLight" to "black".
fontWidthSpecifies the width variant of the font if available. Possible values include "compressed", "condensed", "expanded", and "standard". You can also use a numeric value if supported.
fontDesignModifies the font design. Options include "default", "monospaced", "rounded", "serif".
minScaleFactorA number between 0 and 1 that indicates how much the text can shrink if it doesn’t fit the available space. For example, 0.5 means the text can shrink down to 50% of its original size to fit.
boldApplies a bold font weight if true.
baselineOffsetAdjusts the text’s vertical position relative to its baseline. Positive values move the text up, negative values move it down.
kerningControls the spacing between characters. A positive value increases spacing; a negative value decreases it.
italicApplies an italic style if true.
monospacedForces all child text to use a monospaced variant, if available.
monospacedDigitUses fixed-width digits while leaving other characters as they are. This helps align numbers vertically, useful for tables or timers.
strikethroughApplies a strikethrough (line through the text). You can provide a color, or an object specifying a pattern and color.
strikethrough="red"strikethrough={{ pattern: 'dash', color: 'blue' }}underlineApplies an underline in a similar way to strikethrough.
underline="blue"underline={{ pattern: 'dashDot', color: 'green' }}lineLimitSpecifies how many lines of text can display. You can provide:
{ min?: number; max: number; reservesSpace?: boolean } to specify a minimum and maximum number of lines, and whether the text should reserve space for all those lines even when not used.lineSpacingSets the spacing between lines, in pixels.
multilineTextAlignmentSets the text alignment for multi-line text: "leading", "center", or "trailing".
truncationModeSpecifies how to truncate a line of text when it is too long to fit within the available horizontal space.
Defines the position at which the text is truncated:
"head": Truncates the beginning of the line, preserving the end.
"middle": Truncates the middle of the line, preserving both the beginning and end.
"tail": Truncates the end of the line, preserving the beginning.
allowsTightening?: booleanDetermines whether the system is allowed to reduce the spacing between characters to fit the text within a line when needed.
boolean
false
When set to true, the system may compress the character spacing to avoid truncation and better fit the content. This is typically used to improve layout responsiveness in constrained environments.
By combining these properties, you can fully control the typography of your text-based views without needing multiple wrapper components or modifiers. Whether you need a bold, italic headline font with custom kerning and underline, or a simple body font that truncates after two lines, these options cover a broad range of text styling needs.